package com.changgou.user.dao;

import com.changgou.user.pojo.PointLog;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

public interface PointLogMapper extends Mapper<PointLog> {

//    @Select("select * from tb_point_log where order_id =#{orderId}")
    @Select("select t1.point,t2.order_id as orderId " +
            "from tb_user t1 left join tb_point_log t2 " +
            "on t1.id = t2.user_id " +
            "where t1.id = #{userId} " +
            "and (t2.order_id is null or t2.order_id = #{orderId})")
    //
    PointLog findPointLogByOrderId(@Param("orderId") String orderId);
}
